package com.kob.backend.controller.aution;

import com.kob.backend.service.auction.AuctionTaskService;
import com.kob.backend.vo.AuctionTaskVo;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <pre>{@code
 *
 * }</pre>
 *
 * @author Summerday
 * @date 2023/3/17
 */
@RequestMapping("/auction_task")
@RestController
public class AuctionTaskController {

    @Resource
    AuctionTaskService auctionTaskService;

    @GetMapping("/ev/{id}")
    public Map<String, List<AuctionTaskVo>> getByEV(@PathVariable Integer id) {
        List<AuctionTaskVo> res = auctionTaskService.getByEVId(id);
        Map<String, List<AuctionTaskVo>> map = new HashMap<>();
        map.put("auctionTasks", res);
        return map;
    }

    @GetMapping("/auction/{id}")
    public Map<String, List<AuctionTaskVo>> getByAuctionId(@PathVariable Integer id) {
        List<AuctionTaskVo> res = auctionTaskService.getByAuctionId(id);
        Map<String, List<AuctionTaskVo>> map = new HashMap<>();
        map.put("auctionTasks", res);
        return map;
    }

    @GetMapping("/rsu/{id}")
    public Map<String, List<AuctionTaskVo>> getByRSu(@PathVariable Integer id) {
        List<AuctionTaskVo> res = auctionTaskService.getByRSUId(id);

        Map<String, List<AuctionTaskVo>> map = new HashMap<>();
        map.put("auctionTasks", res);
        return map;
    }

    @GetMapping("/list")
    public List<AuctionTaskVo> getList() {
        return auctionTaskService.getList();
    }
}
